import { watch, defineEmits, Ref } from "vue";
import { slideUp, slideDown } from "@/utils/slide";

export const useSlide = (event: Ref<any>) => {
  const emit = defineEmits(["slideUp", "slideDown"]);
  watch(event, () => {
    slideUp(event.value, () => {
      console.log("event");
      emit("slideUp");
    });
    slideDown(event.value, () => {
      emit("slideDown");
    });
  });
  return {
    emit,
    watch,
  };
};
